import SwiftUI

struct RoundBackButton: View {
    
    enum BgColor {
        case gray
        case white
        
        var color: Color {
            switch self {
            case .gray:
                Color.fsF5F5F5
            case .white:
                Color.fsFFFFFF
            }
        }
    }
    
    var bgColor: BgColor
    @Environment(Router.self) private var router
    
    var body: some View {
        Image(.iconBack)
            .resizable()
            .frame(width: 24, height: 24)
            .padding(8.0)
            .background(
                Circle()
                    .fill(bgColor.color)
            )
            .onTapGesture {
                router.pop()
            }
    }
}

#Preview {
    RoundBackButton(bgColor: .gray)
        .environment(Router())
}
